﻿using System;
using System.Threading;

namespace ShuttleBus.Threading
{
    public class ThreadFactory : IThreadFactory
    {
        public Thread[] Create(int threadCount, Action<object> method)
        {
            var threads = new Thread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                threads[i] = new Thread(new ParameterizedThreadStart(method)) { Name = "ShuttleBus-" + (i + 1), IsBackground = true };
            }
            return threads;
        }
    }
}